<template>
  <div>
    <el-button >dianji</el-button>
    <el-select placeholder="请选择2" v-model="selectValue" >
      <el-option v-for="item in dataList.SHOW" :key="item.dict_code" :value="item.dict_value" :label="item.dict_label"></el-option>
    </el-select>
    <el-button @click="getCode()">getCode</el-button>
    <el-button @click="getCode1()">getCode1</el-button>
  </div>
</template>


<script>
  import {Decrypt,Encrypt} from '../utils/cryptoAES'
  export default {
  name: 'HelloWorld',
  data () {
    return {
      returnMsg:'',
      msg: 'Welcome to Your Vue.js App',
      dataList:{},
      selectValue:'1',
      value:'1',
    }
  },
  computed:{

  },
  created() {
    console.log(!this.$store.state.getDicts.dictsData)
    if (!this.$store.state.getDicts.dictsData){
      var data = Decrypt(sessionStorage.getItem('dicts'))
      console.log("data=>")
      console.log(data)
      this.$store.dispatch('getDictsAction',data)
    }


    console.log(3)
  },
  mounted() {
    console.log(4)
    console.log(this.$store.state.getDicts.dictsData)
    this.dataList = this.$store.state.getDicts.dictsData
  },
  methods:{
    getCode(){
      this.$axios({
        method: "get",
        url: 'getCode',
        params:{
          dictType: 'SEX'
        }
      }).then(res=>{
        this.returnMsg = res.data
      })
    },
    getCode1(){
      this.$axios({
        method: "get",
        url: 'getCode1',
        params:{
          dictType: 'SEX'
        }
      }).then(res=>{
        this.returnMsg = res.data
      })
    },
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
  $highlight-color: #F91;
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
